import { IsInt, IsNotEmpty, IsOptional, Length, Min } from "class-validator";

//用户名
export class UserName {
  @IsNotEmpty({message:'请输入用户名'})
  @Length(5,15,{message:'用户名长度在5~15之间'})
  username: string;
}

//非必传用户名
export class IsUserName {
  @IsOptional()
  username?: string;
}

//密码
export class PassWord {
  @IsNotEmpty({message:'请输入密码'})
  @Length(6,20,{message:'用户名长度在6~20之间'})
  password: string;
}

//用户等级
export class Level {
  @IsOptional()
  @IsInt({message:'整数类型'})
  @Min(0)
  level: number;
}